
package net.lab0.fractal.concurrent;


/**
 * @author  116
 */
public abstract class QueueableRunnable<In, Out>
implements QueueableRunnableInterface<In, Out>
{
    /**
	 * @uml.property  name="queueableRunnableGroup"
	 * @uml.associationEnd  
	 */
    private QueueableRunnableGroup<In, Out> queueableRunnableGroup;
    protected boolean                       stop   = false;
    protected boolean                       finish = false;
    
    public QueueableRunnable(QueueableRunnableGroup<In, Out> queueableRunnableGroup)
    {
        this.queueableRunnableGroup = queueableRunnableGroup;
    }
    
    /**
	 * @return
	 * @uml.property  name="queueableRunnableGroup"
	 */
    @Override
    public QueueableRunnableGroup<In, Out> getQueueableRunnableGroup()
    {
        return queueableRunnableGroup;
    }
    
    @Override
    public void stopWork()
    {
        finish = true;
        stop = true;
    }
    
    @Override
    public boolean isStopped()
    {
        return stop;
    }
    
    @Override
    public void finishWork()
    {
        finish = true;
    }
    
    @Override
    public boolean isFinishing()
    {
        return finish;
    }
}
